﻿package app.view.components.guiDima.switchContent 
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.text.AntiAliasType;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.text.TextFormatAlign;
	/**
	 * Контейнер только с текстом
	 * @author Dmitryi_Koruagin, icq:585466579, dmitryikoruagin@mail.ru, skype: ok_ru1
	 */
	public class ContentTextD extends ContentBaseD
	{
		private var _field:TextField;
		
		//	public
		
		//	private
		
		//	const
		
		
		//	CONSTRUCTOR
		public function ContentTextD(w:Number,h:Number) 
		{
			super(w,h);
			
		}
		
		//	METHODS
		//	private
		override public function init():void
		{
			super.init();
			
			// далее добавляем что нужно в соответствии контенту
			////trace('tyt!!',_contentWidth);
			
			var format:TextFormat = new TextFormat();
			format.size = 25;
			format.kerning = true;
			format.align = TextFormatAlign.JUSTIFY;
			format.font='_sans'//'Arial'
			
			_field = new TextField();
			_field.x = _gapLeft;
			_field.y = _gapTop;
			_field.width = _contentWidth - _gapLeft - _gapRight;
			_field.height = _contentHeight - _gapTop - _gapBottom;
			_field.wordWrap = true;
			_field.multiline=true
			_field.mouseEnabled = false;
			_field.defaultTextFormat = format;
			//_field.embedFonts = true;
			_field.antiAliasType = AntiAliasType.ADVANCED;
			//_field.htmlText = '999999999999999999';
			_field.autoSize = TextFieldAutoSize.LEFT;
			addChild(_field);
			
			
		}
		
		
		
		//	public
		override public function onDestroy():void
		{
			
			try 
			{
				removeChild(_field);
			}catch (err:Error){	}
			
			
			super.onDestroy();
		}
		//	----------------------------------------------------------------------------------
		
		//	GETTERS/SETTERS
		override public function get data():Object { return _data; };
		
		override public function set data(value:Object):void 
		{
			super.data = value;
			////trace('***',_data.text);
			_field.htmlText = _data.text;
		};
		//	----------------------------------------------------------------------------------
		
		//	HANDLERS
		
	}

}